I think that should do the trick. Granted, a short move will not get to a constant velocity section, but if it ever gets to the 5th trip state (-ve jerk in your list above) then it must have got to the end of any CV section. If there's less than 7 trip states then, in our application, it doesn't really matter if the motion completes before triggering the redirection.
So maybe the way we could code this (using your function) is simply: